{{!
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}}

<div class="links">
  <ul class="list-unstyled">
  <li class="img-thumbnail row">
    <div class="caption col-md-10"> {{view.title}}</div>
    <div class="corner-icon col-md-1">
      <button class="dropdown-toggle ellipsis-menu button-border" data-toggle="dropdown" href="#"></button>
      <ul class="dropdown-menu">
        <li><button type="button" href="#" class="button-border"
          {{action deleteWidget target="view"}}>
          <i class="icon-trash"></i>&nbsp;{{t common.delete}}</button>
        </li>
      </ul>
    </div>
    <div class="widget-content" >
      {{#if view.isHAEnabled}}
        <table>
          <!--Active NameNode-->
          <tr class="active-namenode-link">
            {{#if view.isActiveNNValid}}
              <td><a href="#" {{action showDetails view.activeNameNode.host}}>{{t dashboard.widgets.HDFSLinks.activeNameNode}}</a></td>
            {{else}}
              <td><a class="disabled-hdfs-link">{{t dashboard.widgets.HDFSLinks.activeNameNode}}</a></td>
            {{/if}}
          </tr>
          <!--Standby NameNodes-->
          <tr class="standby-namenode-link">
            {{#if view.isStandbyNNValid}}
              {{#if view.isTwoStandbyNN}}
                <!--Two Standby NameNodes-->
                <td><a href="#" {{action filterHosts view.twoStandbyComponent}}>{{t dashboard.widgets.HDFSLinks.standbyNameNodes}}</a></td>
              {{else}}
                <!--One Standby NameNode-->
                <td><a href="#" {{action showDetails view.standbyNameNodes.firstObject.host}}>{{t dashboard.widgets.HDFSLinks.standbyNameNode}}</a></td>
              {{/if}}
            {{else}}
              <td><a class="disabled-hdfs-link">{{t dashboard.widgets.HDFSLinks.standbyNameNode}}</a></td>
            {{/if}}
          </tr>
          <!--Data Nodes-->
          <tr class="datanode-link">
            <td>
              <a href="#" {{action filterHosts view.component}}>{{view.model.dataNodesTotal}} {{t dashboard.services.hdfs.datanodes}}</a>
            </td>
          </tr>
        </table>
      {{else}}
        <table>
          <!--NameNode-->
          <tr class="namenode-link">
            <td><a href="#" {{action showDetails view.model.nameNode.host}}>{{t dashboard.services.hdfs.nanmenode}}</a></td>
          </tr>
          <!--SecondaryNameNode-->
          <tr class="secondary-namenode-link">
            <td><a href="#" {{action showDetails view.model.snameNode.host}}>{{t dashboard.services.hdfs.snanmenode}}</a></td>
          </tr>
          <!--Data Nodes-->
          <tr class="datanode-link">
            <td>
              <a href="#" {{action filterHosts view.component}}>{{view.model.dataNodesTotal}} {{t dashboard.services.hdfs.datanodes}}</a>
            </td>
          </tr>
        </table>
      {{/if}}

    </div>

    <div class="link-button">
      {{#if view.model.quickLinks.length}}
        {{#view App.QuickLinksView contentBinding="view.model" masterGroupsBinding="view.masterGroupsArray"
          shouldSetGroupedLinks=true}}
          <div class="btn-group">
            <a class="dropdown-toggle" data-toggle="dropdown" href="#">
              {{t common.more}}
              <span class="caret"></span>
            </a>
              <ul class="dropdown-menu">
                {{#if view.isLoaded}}
                  {{#if view.quickLinksArray}}
                    <!--there are multiple masters eg, HBase multiple masters or HDFS HA enabled-->
                    {{#each group in view.quickLinksArray}}
                      {{#each quickLinks in group.links}}
                        <li class="dropdown-submenu">
                          <a href="javascript:void(null)">{{quickLinks.publicHostNameLabel}} &nbsp;</a>
                          <ul class="dropdown-menu">
                            {{#each quickLinks}}
                              <li><a {{bindAttr href="url"}} target="_blank" rel="noopener noreferrer">{{label}}</a></li>
                            {{/each}}
                          </ul>
                        </li>
                      {{/each}}
                    {{/each}}
                  {{else}}
                    {{#each view.quickLinks}}
                      <li><a {{bindAttr href="url"}} target="_blank" rel="noopener noreferrer">{{label}}</a></li>
                    {{/each}}
                  {{/if}}
                {{else}}
                  {{view App.SpinnerView}}
                {{/if}}
              </ul>
          </div>
        {{/view}}
      {{/if}}
    </div>
  </li>
    </ul>
</div>
